/**
 * 
 */
package com.jr.javachat.listener;

import java.io.*;

/**
 * ClientContentListener
 * 
 * 编写时间：2011-5-8下午11:33:43
 * 
 * @author <a href="http://xiulin.tk/">彭修林</a>
 * 
 */
public class RemoteContentListener implements Runnable {

	private DataInputStream in;

	/**
	 * @param in
	 */
	public RemoteContentListener(DataInputStream in) {
		this.in = in;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.lang.Runnable#run()
	 */
	@SuppressWarnings("deprecation")
	@Override
	public void run() {
		while(true){
			String remoteInput;
			try {
				//XXX 如何判断用户推出？
				remoteInput = in.readLine();
				if(remoteInput!=null){
					System.out.println("远程用户输入:"+remoteInput);
				}else{
					in.close();
					break;
				}
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
}
